package com.lagou.mr;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * mapper类
 */
public class SortMapper extends Mapper<LongWritable, Text,LongWritable, NullWritable> {
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        //将读取到的每一行文本，转为long类型 再转为LongWritable作为key，value为空，写出到reduce
        context.write(new LongWritable(Long.parseLong(value.toString())), NullWritable.get());
    }
}
